package com.zhiyou100.filter;

import lombok.extern.slf4j.Slf4j;

import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;

/**
 * 过滤器测试1
 *
 * @author yang
 * @version 1.0.0
 * @date 2020-10-20 09:19
 */
@Slf4j
public class FilterTest01 implements Filter {
    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
        final HttpServletRequest request1 = (HttpServletRequest) request;
        final String path = request1.getServletPath();
        log.error(" FilterTest01 执行了，拦截到请求 {} ", path);
        // 放行
        chain.doFilter(request, response);
    }

}
